#include "AuxByte.h"


void CAuxByte::CopyString2Byte(const string& str, BYTE* pb, int nBufSize)
{
	ZeroMemory(pb, nBufSize);
	
	memcpy_s(pb, nBufSize, str.c_str(), str.length());
}

void CAuxByte::CopyByte2String(string&str, BYTE* pb, int bufSize)
{
	BYTE* pbtemp = new BYTE[bufSize+1];

	memcpy_s(pbtemp, bufSize, pb, bufSize);
	pbtemp[bufSize] = 0;

	char* pchar = reinterpret_cast<char*>(pbtemp);
	str = pchar;

	delete [] pbtemp;
}
